Running an analysis

The solver module is used to interact with OpenSees.

The most convenient approach is using a child of the Analysis class from those already defined in the solver module for the specific analysis that is needed. This will run the analysis and store the requested results of each analysis step.

Alternatively, a generic Analysis object can be defined (from the parent class), and its generic methods for model definition can be used together with OpenSees commands issued directly in the analysis script. If such an analysis is repeated a lot, a new Analysis child class can be defined in the solver module.

Analysis examples

First we define a model.

[1]:
# This cell defines the model from notebook 2_Define_a_Model
import numpy as np
from osmg import model
import osmg.defaults as defaults
from osmg.gen.section_gen import SectionGenerator
from osmg.ops.section import ElasticSection
from osmg.gen.component_gen import BeamColumnGenerator
from osmg.ops.element import ElasticBeamColumn
from osmg.gen.zerolength_gen import gravity_shear_tab
from osmg.load_case import LoadCase
from osmg.preprocessing.self_weight_mass import self_weight
from osmg.preprocessing.self_weight_mass import self_mass
from osmg.graphics.preprocessing_3d import show
mdl = model.Model('example_model')
for i in range(3):
    mdl.add_level(i, 144.00*(i))
defaults.load_default_steel(mdl)
defaults.load_default_fix_release(mdl)
defaults.load_util_rigid_elastic(mdl)
steel_phys_mat = mdl.physical_materials.retrieve_by_attr(
    'name', 'default steel')
secg = SectionGenerator(mdl)
secg.load_aisc_from_database(
    'W',
    ["W24X94"],
    'default steel',
    'default steel',
    ElasticSection)
mdl.levels.set_active([1, 2])
p1 = np.array((0.00, 0.00))
p2 = np.array((360., 0.00))
p3 = np.array((360., 360.))
p4 = np.array((0.00, 360.00))
mcg = BeamColumnGenerator(mdl)
sec = mdl.elastic_sections.retrieve_by_attr('name', 'W24X94')
for pt in [p1, p2, p3, p4]:
    mcg.add_pz_active(
        pt[0], pt[1],
        sec,
        steel_phys_mat,
        0.00,
        24.00,
        24.00,
        "steel_w_col_pz_updated",
        {'pz_doubler_plate_thickness': 0.00,
         'axial_load_ratio': 0.00,
         'slab_depth': 0.00,
         'consider_composite': False,
         'location': 'interior',
         'only_elastic': False,
         'moment_modifier': 1.00,
        })
    mcg.add_vertical_active(
        x_coord=pt[0], y_coord=pt[1],
        offset_i=np.zeros(3), offset_j=np.zeros(3),
        transf_type='Corotational',
        n_sub=1,
        section=sec,
        element_type=ElasticBeamColumn,
        placement='centroid',
        angle=0.00)
snap_i_list = ['centroid', 'middle_front', 'centroid', 'middle_back']
snap_j_list = ['centroid', 'middle_back', 'centroid', 'middle_front']
for i, pair in enumerate([(p1, p2), (p2, p3), (p3, p4), (p4, p1)]):
    mcg.add_horizontal_active(
        xi_coord=pair[0][0],
        yi_coord=pair[0][1],
        xj_coord=pair[1][0],
        yj_coord=pair[1][1],
        offset_i=np.zeros(3),
        offset_j=np.zeros(3),
        snap_i=snap_i_list[i],
        snap_j=snap_j_list[i],
        transf_type='Linear',
        n_sub=4,
        section=sec,
        element_type=ElasticBeamColumn,
        placement='top_center',
        angle=0.00,
        method='generate_hinged_component_assembly',
        additional_args={
            'n_x': None,
            'n_y': None,
            'zerolength_gen_i': gravity_shear_tab,
            'zerolength_gen_args_i': {
                'consider_composite': True,
                'section': sec,
                'physical_material': steel_phys_mat,
                'distance': 10.00,
                'n_sub': 2
            },
            'zerolength_gen_j': gravity_shear_tab,
            'zerolength_gen_args_j': {
                'consider_composite': True,
                'section': sec,
                'physical_material': steel_phys_mat,
                'distance': 10.00,
                'n_sub': 2
            }
        }
    )
for node in mdl.levels[0].nodes.values():
    node.restraint = [True]*6
testcase = LoadCase('test', mdl)
self_weight(mdl, testcase)
self_mass(mdl, testcase)
testcase.rigid_diaphragms([1, 2])
[2]:
show(mdl, testcase, extrude=True)

Static Analysis

[3]:
from osmg import solver
[4]:
# instantiate analysis object
static_anl = solver.StaticAnalysis(mdl, {testcase.name: testcase})
[5]:
static_anl.run()

Retrieving results

Analysis results are stored in dictionaries. The keys are the unique identifiers of the elements that the results correspond to, and the values contain the results.

Show all node displacement results

[6]:
# DANGER: Don't do this for a large model.
static_anl.results[testcase.name].node_displacements.items()
[6]:
dict_items([(24, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (49, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (74, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (99, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (0, {0: [-2.5613606882987474e-14, 1.7265125528810346e-07, -0.0012586174501053049, -2.4986523892841926e-06, 4.274053967789948e-05, 1.4502748330462285e-18]}), (5, {0: [-0.0002696903680189259, -0.00011698873243792799, -0.0012837579008100602, -1.0080348230905097e-05, 2.2319836498717605e-05, 1.7106571785039465e-10]}), (6, {0: [-0.0002696862624416975, -0.00011864489630501949, -0.0012210781144692357, -9.901462296692298e-06, 2.2319498503495764e-05, 1.7106571785046462e-10]}), (11, {0: [-0.0005354828823736845, -0.00023746244386532709, -0.0012434781525435246, -2.4962954199123105e-06, 7.126808064675972e-06, 3.4213143425065183e-10]}), (25, {0: [-2.5613606882987474e-14, 1.7265125581020245e-07, -0.0012586174501052938, -2.4986523892911446e-06, -4.274053967793164e-05, 1.4502748330462285e-18]}), (30, {0: [0.0002696903679679162, -0.00011698873243748108, -0.001283757900810132, -1.0080348230911351e-05, -2.2319836498738564e-05, -1.7106571496344616e-10]}), (31, {0: [0.00026968626239075706, -0.00011864489630457248, -0.0012210781144691419, -9.901462296698556e-06, -2.2319498503516692e-05, -1.7106571496352335e-10]}), (36, {0: [0.0005354828823229597, -0.00023746244386495518, -0.0012434781525435137, -2.4962954199191575e-06, -7.126808064691553e-06, -3.421314313773195e-10]}), (50, {0: [-2.613570582288425e-14, 1.7265125581020245e-07, -0.0012604649482101716, 2.3087720943123383e-06, -4.2740539638797814e-05, 1.4502748330462285e-18]}), (55, {0: [0.00026968627321901603, 0.00012349499763292832, -0.0012232472716590592, 1.0267856311958853e-05, -2.2319499390648047e-05, 1.697558795955921e-10]}), (56, {0: [0.00026969034736012634, 0.00012378908697303434, -0.0012813834716693165, 1.0626528965890756e-05, -2.2319834797938564e-05, 1.6975587959558681e-10]}), (61, {0: [0.0005354828725341513, 0.00024876312029834793, -0.0012433763107766603, 2.3079728540553305e-06, -7.126807935924665e-06, 3.3951175774091095e-10]}), (75, {0: [-2.613570582288425e-14, 1.7265125528810346e-07, -0.001260464948210163, 2.308772094319364e-06, 4.274053963882739e-05, 1.4502748330462285e-18]}), (80, {0: [-0.0002696862732712674, 0.00012349499763248238, -0.001223247271658967, 1.02678563119652e-05, 2.23194993906432e-05, -1.6975587678127598e-10]}), (81, {0: [-0.00026969034741231024, 0.0001237890869725883, -0.0012813834716693918, 1.0626528965897086e-05, 2.2319834797933895e-05, -1.6975587678129294e-10]}), (86, {0: [-0.0005354828725863082, 0.000248763120297978, -0.0012433763107766518, 2.3079728540622533e-06, 7.126807935891521e-06, -3.395117550128199e-10]}), (12, {0: [-5.1294392045969765e-14, 1.1905545063506794e-05, -0.0018451516126740115, -7.576787265887465e-06, 4.690221456330147e-05, 5.8683589158174915e-18]}), (17, {0: [-0.0001619544726282592, -0.0001328372978471719, -0.0019339910154654574, -1.2391208556267817e-05, 1.3270983006914344e-05, 2.0701308958031586e-09]}), (18, {0: [-0.00016190478948675997, -0.000134264341973948, -0.0017534988096084632, -1.21808239197879e-05, 1.3266892798566172e-05, 2.0701308958030403e-09]}), (23, {0: [-0.0003179697663959369, -0.0002804342290114028, -0.001839967617202331, -7.266680289063888e-06, -6.965399557179345e-06, 4.140261785737711e-09]}), (37, {0: [-5.1294392045969765e-14, 1.19055450656194e-05, -0.0018451516126739953, -7.576787265900008e-06, -4.690221456332086e-05, 5.8683589158174915e-18]}), (42, {0: [0.00016195447252621067, -0.0001328372978452073, -0.0019339910154655916, -1.2391208556280131e-05, -1.3270983006971334e-05, -2.0701308839722122e-09]}), (43, {0: [0.00016190478938499534, -0.00013426434197198338, -0.0017534988096082965, -1.2180823919800231e-05, -1.3266892798623352e-05, -2.070130883972004e-09]}), (48, {0: [0.0003179697662947188, -0.0002804342290095862, -0.001839967617202315, -7.26668028907644e-06, 6.965399557102482e-06, -4.14026177381247e-09]}), (62, {0: [-5.340700125566422e-14, 1.19055450656194e-05, -0.0018481986195594325, 7.358397274778059e-06, -4.690221456073065e-05, 5.8683589158174915e-18]}), (67, {0: [0.00016190480657265945, 0.00015797762027800472, -0.0017579507574159098, 1.2167053692827891e-05, -1.3266894213596856e-05, 2.0686747265329467e-09]}), (68, {0: [0.0001619544547660963, 0.00015776543735636296, -0.0019332033590185843, 1.2489783577804672e-05, -1.3270981544879295e-05, 2.0686747265331076e-09]}), (73, {0: [0.0003179697657247655, 0.0003052637666854878, -0.0018417998820094885, 7.048512353722255e-06, 6.965399556177663e-06, 4.137349447197471e-09]}), (87, {0: [-5.340700125566422e-14, 1.1905545063506794e-05, -0.0018481986195594208, 7.358397274790469e-06, 4.690221456073821e-05, 5.8683589158174915e-18]}), (92, {0: [-0.00016190480667987482, 0.00015797762027603877, -0.0017579507574157491, 1.2167053692840109e-05, 1.3266894213618592e-05, -2.0686747148566265e-09]}), (93, {0: [-0.00016195445487303137, 0.00015776543735439698, -0.0019332033590187215, 1.2489783577816873e-05, 1.3270981544901149e-05, -2.0686747148567378e-09]}), (98, {0: [-0.00031796976583210317, 0.0003052637666836684, -0.0018417998820094768, 7.048512353734672e-06, -6.9653995561588305e-06, -4.137349435581649e-09]}), (1, {0: [1.8962410326071712e-07, 1.3577746435134692e-06, -0.00128840920860803, -2.556090706785797e-06, 2.2668350299681664e-05, -2.3592749998061394e-08]}), (2, {0: [1.896860324066922e-07, 1.7265125528810346e-07, -0.0012262476392815613, -2.7969001583258555e-06, 2.2668015412260004e-05, 2.3602035572764364e-08]}), (3, {0: [1.9067925447555053e-07, 1.4371087783269222e-06, -0.0012881173779429587, -9.681608947992087e-06, 2.266834931833174e-05, -2.359274883622413e-08]}), (4, {0: [1.907413200643423e-07, 1.7265125528810346e-07, -0.0012259232948327284, -9.901462296692298e-06, 2.2668014430893706e-05, 2.3602034427200272e-08]}), (7, {0: [-0.0005356766120797873, -0.00023777696978034412, -0.0012766940168109913, -2.903835323477187e-06, 2.2019390579997232e-05, 2.3934881433762314e-08]}), (8, {0: [-0.0005356684628544764, -0.00023746244386532709, -0.00121590858965691, -2.1980476508706476e-06, 2.201905569257557e-05, -2.3259904137063434e-08]}), (9, {0: [-0.0005356776672310021, -0.0002377980246693052, -0.001277137216456118, -1.0060987413469603e-05, 2.2019391308110867e-05, 2.3934880271925045e-08]}), (10, {0: [-0.000535669518142134, -0.00023746244386532709, -0.0012162329341057429, -9.901462296692298e-06, 2.2019056420672832e-05, -2.3259902991499343e-08]}), (26, {0: [-1.896241545229561e-07, 1.3577746440356009e-06, -0.0012884092086081023, -2.5560907067927e-06, -2.2668350299702806e-05, 2.3592750000989084e-08]}), (27, {0: [-1.8968608359931213e-07, 1.7265125581020242e-07, -0.001226247639281467, -2.7969001583327812e-06, -2.266801541228111e-05, -2.360203556989035e-08]}), (28, {0: [-1.9067930573779074e-07, 1.4371087788490561e-06, -0.0012881173779430307, -9.681608947998369e-06, -2.266834931835288e-05, 2.3592748839151816e-08]}), (29, {0: [-1.9074137125696338e-07, 1.7265125581020242e-07, -0.0012259232948326343, -9.901462296698556e-06, -2.2668014430914814e-05, -2.360203442432626e-08]}), (32, {0: [0.0005356766120290282, -0.00023777696977997224, -0.0012766940168110626, -2.903835323484054e-06, -2.2019390580018066e-05, -2.3934881430916118e-08]}), (33, {0: [0.0005356684628037863, -0.00023746244386495518, -0.0012159085896568168, -2.198047650877521e-06, -2.2019055692596375e-05, 2.3259904139963304e-08]}), (34, {0: [0.000535677667180243, -0.00023779802466893335, -0.0012771372164561896, -1.0060987413475855e-05, -2.2019391308131697e-05, -2.3934880269078853e-08]}), (35, {0: [0.0005356695180914439, -0.00023746244386495518, -0.0012162329341056496, -9.901462296698556e-06, -2.2019056420693635e-05, 2.325990299439921e-08]}), (51, {0: [-1.8968587049267343e-07, 1.489738093559417e-06, -0.0012284244104319847, 2.9317551871297644e-06, -2.2668016291300134e-05, 2.360200293851348e-08]}), (52, {0: [-1.8962441597533065e-07, -2.329558970164375e-06, -0.0012860270024919963, 2.040870738071929e-06, -2.2668348614530358e-05, -2.359278851774952e-08]}), (53, {0: [-1.9074115775831942e-07, 1.577906081623079e-06, -0.0012280995882708004, 1.0024634275921164e-05, -2.266801530993388e-05, 2.3602001792886947e-08]}), (54, {0: [-1.9067956784535095e-07, -2.4970610930414898e-06, -0.001285735659767085, 1.0472504025314097e-05, -2.2668347633180353e-05, -2.359278735597441e-08]}), (57, {0: [0.0005356684842373979, 0.00024744603346059873, -0.0012180701328861339, 2.0092858092881556e-06, -2.2019056569982087e-05, -2.32624911793223e-08]}), (58, {0: [0.0005356765710651011, 0.0002503947330511142, -0.00127432828843576, 2.7150107803597827e-06, -2.201938889321231e-05, 2.3932300276940706e-08]}), (59, {0: [0.0005356695395246636, 0.0002473578654725351, -0.0012183949550473182, 1.0348930323971416e-05, -2.2019057298079398e-05, -2.3262490033695766e-08]}), (60, {0: [0.0005356776262169711, 0.00025050395592813896, -0.001274770942180616, 1.0526094136442699e-05, -2.201938962132587e-05, 2.3932299115165595e-08]}), (76, {0: [1.8968581818668132e-07, 1.489738093037206e-06, -0.0012284244104318921, 2.931755187136737e-06, 2.2668016291295885e-05, -2.360200293564147e-08]}), (77, {0: [1.8962436373893434e-07, -2.3295589706864e-06, -0.0012860270024920718, 2.0408707380789343e-06, 2.266834861452629e-05, 2.3592788520675636e-08]}), (78, {0: [1.9074110545232852e-07, 1.5779060811008606e-06, -0.0012280995882707078, 1.0024634275927534e-05, 2.266801530992963e-05, -2.3602001790014933e-08]}), (79, {0: [1.9067951560895583e-07, -2.4970610935635103e-06, -0.0012857356597671605, 1.0472504025320433e-05, 2.266834763317628e-05, 2.3592787358900525e-08]}), (82, {0: [-0.0005356684842895878, 0.0002474460334602289, -0.0012180701328860421, 2.009285809295104e-06, 2.20190565699767e-05, 2.3262491182078915e-08]}), (83, {0: [-0.0005356765711172256, 0.00025039473305074416, -0.0012743282884358348, 2.7150107803667254e-06, 2.2019388893207094e-05, -2.3932300274238178e-08]}), (84, {0: [-0.0005356695395768535, 0.00024735786547216526, -0.0012183949550472264, 1.0348930323977757e-05, 2.2019057298074008e-05, 2.3262490036452378e-08]}), (85, {0: [-0.0005356776262690956, 0.0002505039559277689, -0.0012747709421806908, 1.0526094136449035e-05, 2.201938962132065e-05, -2.3932299112463067e-08]}), (100, {0: [-0.0004904605621395337, -3.018597527450035e-05, -0.0017047541553915407, -2.4986523892843696e-06, 4.615124192142233e-05, 1.4502694060995847e-18]}), (101, {0: [-0.0004902289145589192, -3.018597527450035e-05, -0.0017049072970582075, -2.4986523892843696e-06, 0.00014738045011043592, 1.2018481010238068e-18]}), (102, {0: [-0.0005048790596258131, -3.01859752745076e-05, -0.001477425421010608, -2.498652389284281e-06, 4.469756039310492e-05, 1.4502708282307119e-18]}), (103, {0: [0.0004904605620886973, -3.018597527409172e-05, -0.0017047541553918478, -2.4986523892910074e-06, -4.615124192145376e-05, 1.4502782654090655e-18]}), (104, {0: [0.0004902289145080826, -3.018597527409172e-05, -0.0017049072970585144, -2.4986523892910074e-06, -0.00014738045011043809, 1.2018481081545088e-18]}), (105, {0: [0.0005048790595749767, -3.018597527408447e-05, -0.001477425421010757, -2.498652389291076e-06, -4.4697560393136716e-05, 1.4502773944266866e-18]}), (106, {0: [-0.00024511445729216865, -3.018597527439819e-05, -0.013352521289531212, -2.498652389286029e-06, 0.0001090174454149472, 1.2018481067805034e-18]}), (107, {0: [-2.5418249400310243e-14, -3.0185975274296035e-05, -0.01823599719721463, -2.4986523892876883e-06, 1.8994636967159327e-18, 1.20184810523961e-18]}), (108, {0: [0.0002451144572413322, -3.0185975274193876e-05, -0.013352521289531493, -2.498652389289348e-06, -0.0001090174454149449, 1.2018481057788261e-18]}), (118, {0: [0.0002730400540998767, -0.00011124580572871511, -0.0014027103158260926, -1.339752341981446e-05, -2.2319836448120685e-05, -1.7106571496343502e-10]}), (119, {0: [0.0002730400540998767, -0.00011118752648286275, -0.0014028526764728146, -0.0001135890971420649, -2.2319836448120685e-05, 1.0747235283656245e-13]}), (120, {0: [0.0002730391987713019, -0.00011487329520041646, -0.0013390906353985721, -1.197339433971266e-05, -2.2319836473429623e-05, -1.7106571496343787e-10]}), (121, {0: [0.0002730400201386132, 0.0001181280873745153, -0.0014057367483247926, 1.39316383846213e-05, -2.231983484855607e-05, 1.6975587959558557e-10]}), (122, {0: [0.0002730400201386132, 0.00011806980812866294, -0.0014058790510114042, 0.00011363153998665498, -2.231983484855607e-05, 1.0747235283655088e-13]}), (123, {0: [0.0002730391713592152, 0.00012175557684621666, -0.0013394317192902301, 1.2513449660693416e-05, -2.231983482324732e-05, 1.6975587959558588e-10]}), (124, {0: [0.00027304004560956083, -5.387319282998133e-05, -0.009814545560634151, -8.518039759230574e-05, -2.231983604822953e-05, 1.0747235283655987e-13]}), (125, {0: [0.00027304003711924496, 3.4411408229000907e-06, -0.01336702515981427, -2.4976413071205468e-08, -2.2319835648338376e-05, 1.074723528365553e-13]}), (126, {0: [0.0002730400286289291, 6.075547447578152e-05, -0.009817883562400412, 8.515354368384645e-05, -2.2319835248447223e-05, 1.0747235283655075e-13]}), (136, {0: [0.0004904605616390819, 2.8224232201690624e-05, -0.001706601653108647, 2.3087720943126467e-06, -4.615124188297191e-05, 1.4502412395695044e-18]}), (137, {0: [0.0004902289140586792, 2.8224232201690624e-05, -0.001706754794775314, 2.3087720943126467e-06, -0.00014738045009936424, 1.1992009205574001e-18]}), (138, {0: [0.0005048790591121699, 2.8224232201697875e-05, -0.0014792729189207804, 2.3087720943124925e-06, -4.469756035432888e-05, 1.4502497033859227e-18]}), (139, {0: [-0.0004904605616917126, 2.8224232201282896e-05, -0.001706601653108931, 2.308772094319187e-06, 4.615124188300083e-05, 1.4502910734324817e-18]}), (140, {0: [-0.00049022891411131, 2.8224232201282896e-05, -0.0017067547947755978, 2.308772094319187e-06, 0.00014738045009936621, 1.1992009129778204e-18]}), (141, {0: [-0.0005048790591648007, 2.8224232201275642e-05, -0.001479272918920919, 2.3087720943192755e-06, 4.4697560354358125e-05, 1.450287105202898e-18]}), (142, {0: [0.0002451144570161819, 2.8224232201588692e-05, -0.013354368786542491, 2.308772094314282e-06, -0.00010901744540941121, 1.1992009225379205e-18]}), (143, {0: [-2.6315382804374297e-14, 2.822423220148676e-05, -0.01823784469399062, 2.308772094315917e-06, -1.7390653288374245e-18, 1.1992009258461443e-18]}), (144, {0: [-0.0002451144570688127, 2.822423220138483e-05, -0.013354368786542748, 2.308772094317552e-06, 0.0001090174454094091, 1.1992009175117946e-18]}), (154, {0: [-0.0002730400201907682, 0.0001181280873740702, -0.0014057367483249303, 1.3931638384627481e-05, 2.2319834848552774e-05, -1.6975587678129594e-10]}), (155, {0: [-0.0002730400201907682, 0.00011806980812821785, -0.0014058790510115418, 0.00011363153998665485, 2.2319834848552774e-05, -1.074688099667464e-13]}), (156, {0: [-0.0002730391714113843, 0.00012175557684577158, -0.0013394317192903368, 1.2513449660699672e-05, 2.2319834823243335e-05, -1.6975587678129524e-10]}), (157, {0: [-0.00027304005415091216, -0.00011124580572916107, -0.001402710315825959, -1.3397523419808366e-05, 2.231983644809952e-05, 1.7106571785038475e-10]}), (158, {0: [-0.00027304005415091216, -0.00011118752648330871, -0.0014028526764726813, -0.00011358909714206489, 2.231983644809952e-05, -1.074688099667432e-13]}), (159, {0: [-0.0002730391988223229, -0.00011487329520086244, -0.0013390906353984691, -1.1973394339706487e-05, 2.2319836473408562e-05, 1.7106571785038718e-10]}), (160, {0: [-0.0002730400286808042, 6.075547447533621e-05, -0.0098178835624005, 8.515354368384546e-05, 2.231983524843946e-05, -1.0746880996674341e-13]}), (161, {0: [-0.0002730400371708402, 3.4411408224545704e-06, -0.013367025159814267, -2.4976413072454382e-08, 2.2319835648326148e-05, -1.0746880996673781e-13]}), (162, {0: [-0.0002730400456608762, -5.3873192830427065e-05, -0.009814545560634057, -8.518039759230666e-05, 2.2319836048212832e-05, -1.0746880996673983e-13]}), (13, {0: [4.856946459019366e-07, 1.3660087142514204e-05, -0.0019362473192954647, -7.64922182870337e-06, 1.3823357671501608e-05, -6.042186899506369e-08]}), (14, {0: [4.864440711310967e-07, 1.1905545063506794e-05, -0.0017539992078424418, -7.6056569710024705e-06, 1.3819305072135845e-05, 6.05342369106111e-08]}), (15, {0: [4.883982554199123e-07, 1.3777539113519757e-05, -0.0019361057550997772, -1.2080598207987097e-05, 1.3823356054242367e-05, -6.042186593976587e-08]}), (16, {0: [4.891493317812982e-07, 1.1905545063506794e-05, -0.0017539678120381294, -1.21808239197879e-05, 1.381930345467847e-05, 6.053423405224113e-08]}), (19, {0: [-0.0003185051442346325, -0.0002811380774702049, -0.001929322515822117, -7.536022182941302e-06, 1.2841772474551438e-05, 6.456213078666977e-08]}), (20, {0: [-0.00031840652737686313, -0.0002804342290114028, -0.0017529984113744844, -7.237810583948883e-06, 1.2837719875185667e-05, -5.639397511900501e-08]}), (21, {0: [-0.00031850784784415046, -0.0002811851942591179, -0.0019296154251317087, -1.2347882773359334e-05, 1.2841773442944393e-05, 6.456212773137195e-08]}), (22, {0: [-0.00031840923263751333, -0.0002804342290114028, -0.001753029807178797, -1.21808239197879e-05, 1.2837720843380486e-05, -5.639397226063504e-08]}), (38, {0: [-4.856947486309292e-07, 1.3660087144626704e-05, -0.001936247319295599, -7.649221828715906e-06, -1.3823357671557995e-05, 6.042186900672221e-08]}), (39, {0: [-4.86444173578386e-07, 1.19055450656194e-05, -0.0017539992078422753, -7.605656971015014e-06, -1.381930507219242e-05, -6.053423689879255e-08]}), (40, {0: [-4.883983581489014e-07, 1.3777539115632252e-05, -0.0019361057550999117, -1.2080598207999427e-05, -1.3823356054298754e-05, 6.042186595142438e-08]}), (41, {0: [-4.89149434228584e-07, 1.19055450656194e-05, -0.0017539678120379626, -1.2180823919800231e-05, -1.3819303454735045e-05, -6.053423404042258e-08]}), (44, {0: [0.00031850514413327065, -0.0002811380774683881, -0.0019293225158222515, -7.5360221829538494e-06, -1.2841772474608874e-05, -6.45621307746662e-08]}), (45, {0: [0.00031840652727578746, -0.0002804342290095862, -0.0017529984113743176, -7.237810583961433e-06, -1.283771987524329e-05, 5.639397513084854e-08]}), (46, {0: [0.00031850784774278867, -0.0002811851942573011, -0.0019296154251318431, -1.2347882773371655e-05, -1.2841773443001829e-05, -6.456212771936838e-08]}), (47, {0: [0.00031840923253643766, -0.0002804342290095862, -0.0017530298071786303, -1.2180823919800231e-05, -1.283772084343811e-05, 5.6393972272478574e-08]}), (63, {0: [-4.864439139032304e-07, 1.2727344159773991e-05, -0.0017584522967527205, 7.589678013245733e-06, -1.3819306474115713e-05, 6.05341975951324e-08]}), (64, {0: [-4.856950162149791e-07, 9.329203892457395e-06, -0.0019354585217457596, 7.2282891359018605e-06, -1.3823356222822039e-05, -6.042190876871512e-08]}), (65, {0: [-4.89149173981897e-07, 1.2782356760801857e-05, -0.0017584208293537483, 1.2015294793440675e-05, -1.3819304856658405e-05, 6.053419473669315e-08]}), (66, {0: [-4.883986263249781e-07, 9.156739320423975e-06, -0.0019353170291447318, 1.2331195465590033e-05, -1.3823354605562727e-05, -6.042190571348655e-08]}), (69, {0: [0.0003184065613918249, 0.0003044419675913332, -0.0017574492180790992, 7.019576814437533e-06, -1.2837721277230643e-05, -5.63968481420665e-08]}), (70, {0: [0.00031850510888101023, 0.0003067894142384444, -0.001928536163492766, 7.317779008548564e-06, -1.2841771025936959e-05, 6.455925822178094e-08]}), (71, {0: [0.00031840926665190354, 0.0003043869549903053, -0.0017574806854780713, 1.2217639992623628e-05, -1.283772224542553e-05, -5.639684528362727e-08]}), (72, {0: [0.0003185078124911202, 0.00030689154362838525, -0.0019288289909798896, 1.2395871495100451e-05, -1.2841771994329843e-05, 6.455925516655238e-08]}), (88, {0: [4.86443806947761e-07, 1.2727344157661352e-05, -0.0017584522967525598, 7.589678013258137e-06, 1.3819306474137268e-05, -6.053419758331804e-08]}), (89, {0: [4.856949095411605e-07, 9.329203890344934e-06, -0.001935458521745897, 7.228289135914273e-06, 1.3823356222843704e-05, 6.042190878036987e-08]}), (90, {0: [4.891490670264243e-07, 1.2782356758689216e-05, -0.0017584208293535877, 1.2015294793452901e-05, 1.381930485667996e-05, -6.053419472487881e-08]}), (91, {0: [4.883985196511559e-07, 9.156739318311524e-06, -0.001935317029144869, 1.2331195465602242e-05, 1.3823354605584394e-05, 6.04219057251413e-08]}), (94, {0: [-0.0003184065614993014, 0.00030444196758951385, -0.0017574492180789387, 7.019576814449949e-06, 1.2837721277252401e-05, 5.639684815360478e-08]}), (95, {0: [-0.0003185051089882079, 0.0003067894142366249, -0.0019285361634929035, 7.317779008560978e-06, 1.2841771025958841e-05, -6.455925821008311e-08]}), (96, {0: [-0.00031840926675938007, 0.000304386954988486, -0.0017574806854779108, 1.2217639992635846e-05, 1.283772224544729e-05, 5.639684529516555e-08]}), (97, {0: [-0.0003185078125983179, 0.00030689154362656575, -0.001928828990980027, 1.239587149511266e-05, 1.2841771994351726e-05, -6.455925515485454e-08]}), (109, {0: [-0.0005382170345685159, -8.015242021696705e-05, -0.0023325584851109516, -7.576787265887802e-06, 5.024360046616117e-05, 5.868364050920137e-18]}), (110, {0: [-0.0005379628313083107, -8.015242021696705e-05, -0.002332711626777618, -7.576787265887802e-06, 0.00014855882790170753, 5.420117450044811e-18]}), (111, {0: [-0.0005540394707819611, -8.015242021699639e-05, -0.0020846813125804955, -7.576787265887634e-06, 4.882457710817534e-05, 5.868362519172843e-18]}), (112, {0: [0.0005382170344661628, -8.01524202151242e-05, -0.002332558485111127, -7.576787265899668e-06, -5.02436004661801e-05, 5.8683676316669294e-18]}), (113, {0: [0.0005379628312059576, -8.01524202151242e-05, -0.0023327116267777936, -7.576787265899668e-06, -0.000148558827901709, 5.4201173378173586e-18]}), (114, {0: [0.0005540394706796079, -8.015242021509486e-05, -0.0020846813125805757, -7.5767872658998386e-06, -4.88245771081945e-05, 5.868365704467159e-18]}), (115, {0: [-0.00026898141567974367, -8.015242021650633e-05, -0.014055447203444154, -7.5767872658907685e-06, 0.00010960663431058235, 5.4201174146233015e-18]}), (116, {0: [-5.117659349600719e-14, -8.015242021604562e-05, -0.01896396363919203, -7.576787265893736e-06, 1.1369787485142361e-18, 5.420117367514081e-18]}), (117, {0: [0.0002689814155773905, -8.015242021558492e-05, -0.014055447203444323, -7.576787265896702e-06, -0.00010960663431058101, 5.420117346662278e-18]}), (127, {0: [0.0001639658212860958, -0.0001259401989602712, -0.0020758495845805297, -1.5667944714903373e-05, -1.3270982963455753e-05, -2.070130883972244e-09]}), (128, {0: [0.0001639658212860958, -0.00012586986377817862, -0.002075991921361101, -0.0001141659140381673, -1.3270982963455753e-05, 1.0297785628509835e-13]}), (129, {0: [0.00016395547063167594, -0.00013031808904446015, -0.0020008273758913703, -1.4263997049444862e-05, -1.3270982985213545e-05, -2.0701308839722362e-09]}), (130, {0: [0.0001639657887450932, 0.00015088312472465547, -0.0020760369236927376, 1.5764390575780618e-05, -1.3270981588393578e-05, 2.068674726533139e-09]}), (131, {0: [0.0001639657887450932, 0.0001508127895425629, -0.0020761792502455, 0.00011417559801689726, -1.3270981588393578e-05, 1.0297785628516235e-13]}), (132, {0: [0.00016395544537146055, 0.0001552610148088444, -0.0020005298786747797, 1.436149116272668e-05, -1.3270981566636436e-05, 2.068674726533131e-09]}), (133, {0: [0.00016396581315084515, -5.6699200447993247e-05, -0.010520932365032484, -8.544846153287386e-05, -1.327098261969021e-05, 1.0297785628510776e-13]}), (134, {0: [0.00016396580501559452, 1.2471462882192135e-05, -0.014083019441466076, -3.310214070456611e-09, -1.3270982275924665e-05, 1.0297785628511603e-13]}), (135, {0: [0.00016396579688034385, 8.16421262123775e-05, -0.010521348041510382, 8.544591720645066e-05, -1.3270981932159122e-05, 1.0297785628514227e-13]}), (145, {0: [0.0005382170344343176, 0.00010131007195411396, -0.0023356054919708782, 7.35839727477832e-06, -5.024360046363314e-05, 5.868277055476212e-18]}), (146, {0: [0.0005379628311741264, 0.00010131007195411396, -0.002335758633637545, 7.35839727477832e-06, -0.0001485588279009782, 5.424855313408788e-18]}), (147, {0: [0.0005540394706468935, 0.0001013100719541433, -0.002087728319453116, 7.358397274778189e-06, -4.8824577105625914e-05, 5.868297462279151e-18]}), (148, {0: [-0.0005382170345412234, 0.0001013100719522695, -0.002335605491970941, 7.358397274790193e-06, 5.024360046364052e-05, 5.8683667147548264e-18]}), (149, {0: [-0.0005379628312810322, 0.0001013100719522695, -0.002335758633637608, 7.358397274790193e-06, 0.00014855882790097875, 5.424855225110106e-18]}), (150, {0: [-0.0005540394707537993, 0.00010131007195224016, -0.002087728319453142, 7.358397274790331e-06, 4.882457710563338e-05, 5.868364656123981e-18]}), (151, {0: [0.00026898141556033674, 0.00010131007195365284, -0.014058494210257554, 7.358397274781288e-06, -0.00010960663431021703, 5.4248552758065925e-18]}), (152, {0: [-5.345288643043316e-14, 0.00010131007195319173, -0.01896701064598987, 7.358397274784256e-06, -4.1972156480326366e-19, 5.424855237395437e-18]}), (153, {0: [-0.00026898141566724255, 0.00010131007195273062, -0.014058494210257616, 7.358397274787225e-06, 0.00010960663431021654, 5.424855217871842e-18]}), (163, {0: [-0.00016396578885191483, 0.00015088312472269136, -0.0020760369236929956, 1.5764390575792537e-05, 1.327098158841261e-05, -2.068674714856756e-09]}), (164, {0: [-0.00016396578885191483, 0.00015081278954059879, -0.002076179250245758, 0.00011417559801689701, 1.3270981588412611e-05, -1.0296309892244927e-13]}), (165, {0: [-0.00016395544547834055, 0.0001552610148068803, -0.002000529878674978, 1.4361491162738738e-05, 1.327098156665688e-05, -2.0686747148567514e-09]}), (166, {0: [-0.0001639658213882541, -0.00012594019896223398, -0.0020758495845802738, -1.5667944714891345e-05, 1.3270982963399602e-05, 2.070130895803178e-09]}), (167, {0: [-0.0001639658213882541, -0.0001258698637801414, -0.0020759919213608445, -0.00011416591403816741, 1.3270982963399602e-05, -1.0296309892246979e-13]}), (168, {0: [-0.00016395547073377506, -0.0001303180890464229, -0.0020008273758911747, -1.4263997049432693e-05, 1.3270982985156973e-05, 2.070130895803173e-09]}), (169, {0: [-0.00016396579698599965, 8.164212621041373e-05, -0.010521348041510552, 8.544591720644882e-05, 1.3270981932159359e-05, -1.0296309892244466e-13]}), (170, {0: [-0.00016396580512008445, 1.2471462880228692e-05, -0.01408301944146607, -3.3102140728163585e-09, 1.3270982275906107e-05, -1.0296309892245463e-13]}), (171, {0: [-0.00016396581325416927, -5.6699200449956364e-05, -0.010520932365032308, -8.544846153287565e-05, 1.3270982619652854e-05, -1.0296309892246838e-13]}), (172, {0: [-2.5874656352935866e-14, 1.7265125554915293e-07, 0.0, 0.0, 0.0, 1.4502748330462285e-18]}), (173, {0: [-5.2350696650817094e-14, 1.1905545064563095e-05, 0.0, 0.0, 0.0, 5.8683589158174915e-18]})])
[7]:
# Displacement of the parent node of the top story,
# in the Y direction.
analysis_step = 0
direction = 1
node_id = testcase.parent_nodes[2].uid
static_anl.results[testcase.name].node_displacements[
    node_id][analysis_step][direction]
[7]:
1.1905545064563095e-05

Note: Multiple load cases and analysis objects can be defined using the same model. The results will be stored independently in the various analysis objects.

Visualizing results

The following visualization methods work for all analysis methods. However, some require specifying the analysis step to visualize. Static analyses only have a single step, so we specify 0.

[8]:
from osmg.graphics.postprocessing_3d import show_deformed_shape
from osmg.graphics.postprocessing_3d import show_basic_forces
[9]:
help(show_deformed_shape)
Help on function show_deformed_shape in module osmg.graphics.postprocessing_3d:

show_deformed_shape(analysis: 'Analysis', case_name: 'str', step: 'int', scaling: 'float', extrude: 'bool', camera: 'Optional[dict[str, object]]' = None, subset_model: 'Model' = None, animation: 'bool' = False, init_step: 'int' = 0, step_skip: 'int' = 0, to_html_file: 'Optional[str]' = None) -> 'dict[str, Any]'
    Visualize the model in its deformed state

    Arguments:
      analysis: an analysis object
      case_name: the name of the load_case to be visualized
      step: the analysis step to be visualized
      scaling: scaling factor for the deformations. If 0.00 is
        provided, the scaling factor is calculated automatically.
      extrude: wether to extrude frame elements
      camera: custom positioning of the camera
      subset_model: subset model used to only show certain
        components
      animation: show all frames up to the one identified with
        `step`
      init_step: starting step, in case of animation
      step_skip: how many frames to skip to reduce the number of
        frames in case an animation.
      to_html_file: If a path is specified, the figure is written in
        an html file instead of being shown.

[10]:
show_deformed_shape(static_anl, testcase.name, 0, 0.00, False)
[10]:
{'scaling': np.float64(2024.5678518727877)}
[11]:
help(show_basic_forces)
Help on function show_basic_forces in module osmg.graphics.postprocessing_3d:

show_basic_forces(analysis, case_name, step, scaling_global, scaling_n, scaling_q, scaling_m, scaling_t, num_points, force_conversion=1.0, moment_conversion=1.0, global_axes=False, camera=None, subset_model=None, to_html_file=None)
    Visualize the model and plot the frame element basic forces.

    Arguments:
      analysis: an analysis object
      case_name: the name of the load_case to be visualized
      step: the analysis step to be visualized
      scaling_global: I don't even remember what this
        does. It's kind of a mess right now.
      scaling_n:
      scaling_q:
      scaling_m:
      scaling_t:
      num_points: number of points to include in the basic force
        curves
      force_conversion: Conversion factor to be applied at the
        hover box data for forces (for unit conversions)
      moment_conversion: Conversion factor to be applied at the
        hover box data for moments (for unit conversions)
      global_axes: whether to show global axes
      camera: custom positioning of the camera
      subset_model: use this model instead of the one contained in the
        analysis object. It needs to be a subset of the original
        model. This can be used to only show the results for some part
        of a large model.
      to_html_file: If a path is specified, the figure is written in
        an html file instead of being shown.

[12]:
show_basic_forces(
    static_anl, testcase.name, 0,
    1.00, 1.00, 1.00, 1.00, 1.00,
    10, 1.00, 1.00, False)
[12]:
{'scaling_n': np.float64(0.0023065720290572694),
 'scaling_q': np.float64(0.011840888066593318),
 'scaling_m': np.float64(0.00017171283701762028),
 'scaling_t': 1.0}

Time-history analysis

[17]:
nlth_anl = solver.THAnalysis(mdl, {testcase.name: testcase})
[18]:
help(nlth_anl.run)
Help on method run in module osmg.solver:

run(analysis_time_increment: 'float', ag_vec_x: 'Optional[nparr]', ag_vec_y: 'Optional[nparr]', ag_vec_z: 'Optional[nparr]', ag_vec_time_incr: 'float', finish_time: 'float' = 0.0, skip_steps: 'int' = 1, damping: 'dict[str, Optional[Union[str, float, int, list[float]]]]' = {'type': None}, print_progress: 'bool' = True, drift_check: 'float' = 0.0, time_limit: 'Optional[float]' = None, dampen_out_residual: 'bool' = False, test_tolerance: 'float' = 1e-12) -> 'dict[str, Union[int, str, float]]' method of osmg.solver.THAnalysis instance
    Run the time-history analysis

    Arguments:
        ag_vec_x, y, z: 1-D numpy arrays containing the fixed-step
                        ground acceleration records.
        ag_vec_time_incr:   The corresponding time increment
        finish_time: Specify a target time (s) to stop the analysis
                     the default value of 0.00 means that it will
                     run for the entire duration of the files.
        damping: Can be any of:
                 {'type': None},
                 {'type': 'rayleigh', 'ratio': r, 'periods': [t1, t2]},
                 {'type': 'stiffness', 'ratio': r, 'period': t1}
                 {'type': 'modal', 'num_modes': n, 'ratio': r}
                 {'type': 'modal+stiffness', 'num_modes': n,
                 'ratio_modal': r, 'period': t1,
                 'ratio_stiffness': r}
        print_progress: Controls whether the current time is printed out
        drift_check: If a value other than 0.00 is specified, the
          analysis stops if the drift ratio in each orthogonal
          direction exceeds the specified value. Levels that have
          no parent nodes are excempt from this check.
        time_limit: Maximum analysis time allowed, in hours.
          When reached, the anlysis is interrupted.
        dampen_out_residual: When the analysis finishes, whether to
          dampen out the motion to reveal the residual deformations.
          Note that retrieving the absolute velocity and acceleration
          will not output the correct values after dampening starts.

[19]:
ag_x = np.genfromtxt('groundmotions/1xa.txt')
ag_y = np.genfromtxt('groundmotions/1ya.txt')

nlth_anl.run(
    0.01,
    ag_x, ag_y, None,
    0.005,
    damping={'type': 'rayleigh', 'ratio': 0.05, 'periods': [1.00, 0.30]},
    print_progress=False
)
[19]:
{'successful steps': 3040, 'analysis_finished_successfully': True}
[20]:
parent_node_lvl2 = testcase.parent_nodes[2]
[21]:
nlth_anl.plot_node_displacement_history(
    testcase.name, parent_node_lvl2, 0, plotly=True)

Other types of structural analysis and ideas for future development

  • Currently it is unclear what the intent of each model is (i.e. a linear model used for design or an advanced model used for performance evaluation purposes). There is already support for design-related analyses, such as modal response spectrum analysis, and definition of load combinations, which can support a design workflow. Examples will be added in the future, and there are plans to further enhance the capabilities of osmg for structural design.

  • Future plans include adding support for modal response history analysis which can reduce computation time for linear models.